using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using System.Xml;
using LuaInterface;

namespace RPGGameLibrary
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class StaticMeshs : Microsoft.Xna.Framework.GameComponent
    {
        private Game localgame;
        public string Name;
        public string script;
        public Model Mesh;
      //  public Vector3 position;



        private void LoadDefaultStaticMesh()
        {
            XmlDocument XMlDoc = new XmlDocument();
            XMlDoc.Load("StaticMeshs\\DefaultMesh.xml");
            XmlNodeList List = XMlDoc.SelectSingleNode("StaticMesh").ChildNodes;
            foreach (XmlNode node in List)
            {
                if (node.Name=="Name")
                {
                    Name = node.InnerText;
                }
                if (node.Name=="Mesh")
                {
                    string meshname = node.InnerText;
                    Mesh = localgame.Content.Load<Model>(meshname);
                }
            }

        }
        public StaticMeshs(Game game)
            : base(game)
        {
            localgame = game;
           
            // TODO: Construct any child components here
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
           // script = localgame.Content.Load<string>("first");\

            LoadDefaultStaticMesh();
            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here

            base.Update(gameTime);
        }
    }
}
